package de.mfr.listactivity;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.listenEintraege, android.R.layout.simple_list_item_1); 
		
		this.setListAdapter(adapter);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		String anzeige = getResources().getString(R.string.anzeige_eintrag,position+1);
		Toast.makeText(this, anzeige, Toast.LENGTH_LONG).show();
	}

}
